package com.education.admin.api.user;

/**
 * @Author: dongyaoyao
 * @CreateTime: 2024-08-13
 * @Description:
 * @Version: 1.0
 */

import com.education.common.utils.Result;
import com.education.common.utils.ResultCode;
import com.education.mapper.system.SystemAdminMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system/record")
public class UserMapperTest {
    @Autowired
    SystemAdminMapper systemAdminMapper;

    @GetMapping("/list")
    public String list(Map param) {
        List<Map> list = systemAdminMapper.selectSocketDataList(param);
        for (Object o : list) {
            System.out.println(o);
        }
        return list.toString();
    }

    @PostMapping("/login")
    public Result login(@RequestBody Map<String, String> params) {
        String userName = params.get("userName");
        String password = params.get("password");
        System.err.println(userName + "--------" + password);
        Map Data = systemAdminMapper.login(userName, password);
        if (Data != null) {
            return Result.success(new ResultCode(ResultCode.SUCCESS, "登录成功"), Data);
        }
        return Result.fail(new ResultCode(ResultCode.FAIL, "用户不存在"));
    }

}
